package com.buba.controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.buba.service.MaintenanceWorkOrderService;
import common.R;
import entity.maintenance.MaintenanceWorkOrder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 保养工单 前端控制器
 * </p>
 *
 * @author beisheng
 * @since 2023-05-18
 */
@RestController
@RequestMapping("/maintenance-work-order")
public class MaintenanceWorkOrderController {

    @Autowired
    private MaintenanceWorkOrderService maintenanceWorkOrderService;

    /* *
     * @Author: beisheng
     * @Descriprion: 查询所有保养工单
     * @Date: 2023/6/14 16:02
     * @Return: common.R
     * @Param: []
     */

    @GetMapping("/selMainWorkOrder")
    public R selMainWorkOrder(){
        List<MaintenanceWorkOrder> delete_flag = maintenanceWorkOrderService.list(new QueryWrapper<MaintenanceWorkOrder>().eq("delete_flag", 0));
        return R.success(delete_flag);
    }

    /* *
     * @Author: beisheng
     * @Descriprion: 根据保养工单ID查询基本信息
     * @Date: 2023/6/15 9:01
     * @Return: entity.maintenance.MaintenanceWorkOrder
     * @Param: [id]
     */

    @PostMapping("/getOneMainWorkOrder")
    public MaintenanceWorkOrder getOneMainWorkOrder(@RequestBody Integer id){
        MaintenanceWorkOrder byId = maintenanceWorkOrderService.getById(id);
        return byId;
    }
}

